package com.principle.decorator;

public class Decorator extends Drink{
    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public float cost() {
        //getPrice()是获取自己的价格
        return super.getPrice()+drink.cost();
    }

    @Override
    public String getDes() {
        //drink.getDes() 输出了被装饰者的描述
        return des+super.getPrice()+drink.getDes();
    }
}
